Repository navigation
feat(contexts): save the menu of an application - #3136
rubenvdlinde wants to merge 4 commits into
Conversation
9847aa9 to
5825db2
Compare
6540b64 to
b167dd6
Compare
5825db2 to
9e81a78
Compare
85b998e to
9247115
Compare
9e81a78 to
7e236cc
Compare
b99771d to
86bf312
Compare
enjeck
left a comment
There was a problem hiding this comment.
same comment on tests as in previous PRs. There are too many and it's hard to tell whcih are actualy useful
| $this->menuItemMapper->deleteAllByContextId($context->getId()); | ||
| $this->insertMenuItems($context->getId(), $menuItems, $keptNames); |
There was a problem hiding this comment.
seems like a flawed design if each save deletes the menu and inserts it again
| * @param list<array<array-key, mixed>> $storedMenu | ||
| * @throws Exception|PermissionError | ||
| */ | ||
| private function addMenuTargetsAsNodes(Context $context, array $menuItems, array $storedMenu, ?string $userId): void { |
There was a problem hiding this comment.
i wonder if we can remove this function if menu items point at node_rel_id instead 🤔 . It seems too complicated
| // A transaction that reads before it writes can lose its write lock to a concurrent | ||
| // request (SQLite answers "database is locked" at once); running it again succeeds. |
There was a problem hiding this comment.
Seems unrelated and should be a separate PR?
c7a6e95 to
8574da7
Compare
3593dbc to
9c7797a
Compare
8574da7 to
9af2352
Compare
A menu item has a label, an optional icon and description, and opens a table, a view, a page of the same application or a link. Items have a technical name unique within the application (item_<id> by default) and may sit under another item. An item whose target is gone is read as broken. Applications carry their menu in their responses, loaded for all applications of a response in one query. Deleting an application deletes its menu, and deletes the application row first inside a retried transaction. Co-authored-by: remko48 <remko@conduction.nl> Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Creating and updating an application can include its menu, saved as a whole. Links must be http or https, page targets must be pages of the same application, and tables and views in the menu become part of the application. A new application without a submitted menu gets a Dashboard item that opens its start page. Co-authored-by: remko48 <remko@conduction.nl> Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
9c7797a to
eb6d3f4
Compare
9af2352 to
7d89fa5
Compare
7d89fa5 to
aa0c7e3
Compare
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Part of #3099, on top of #3135 (menu model). Creating and updating an application can now include its menu. This replaces #3087 by @remko48.
Size: 1543 lines: 590 code, 839 tests and 114 generated OpenAPI.
What changes
nodesand in the menu is added once.menuItemsand the new page fields are added.OpenAPI and the TypeScript types are regenerated.
How it was tested
On Nextcloud 34 with PostgreSQL:
MenuItemInputTest: labels, links, targets, technical namesContextServiceTest: saving, the default Dashboard item, page targets, broken items kept, theitem_<id>defaultContextControllerTestandContextPagesRoundTripTest(database: a table in bothnodesand the menu is added once, on create and on update; the response shape stays as on main)composer cs:check, psalm and rector, all clean🖼️ Screenshots
Backend only, no UI changes.
🏁 Checklist
/backport to stableX.X🤖 AI (if applicable)